home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 4
/
FM Towns Free Software Collection 4 - Disc 1.iso
/
t_os
/
helper
/
source
/
keyword.c
< prev
next >
Wrap
Text File
|
1991-10-18
|
19KB
|
767 lines
/*
KEYWORD.C
1991.01.11 make by Ken
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <mos.h>
#include "scrn.h"
#include "keyword.h"
#include "graphic.h"
#include "dir.h"
#include "file.h"
#include "event.h"
#include "coldef.h"
#define TRUE 1
#define FALSE 0
#define ERR (-1)
#define KEY_HAS 8
int prg_max=0;
int key_max=0;
int prg_cnt=0;
int prg_hit=0;
int prg_ofs=0;
char *crent_drive=NULL;
PRGPTR *prg_top=NULL;
static PRGPTR *prg_btm=NULL;
static KEYPTR *key_now=NULL;
KEYPTR *key_tbl[KEY_MAX];
static KEYPTR *key_hash[KEY_HAS]={
NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL };
PRGPTR *prg_tbl[PRG_MAX];
char *strdup(char *str)
{
char *p;
if ( (p = (char *)malloc(strlen(str)+1)) != NULL )
strcpy(p,str);
return p;
}
static int hash_calc(char *str)
{
int hs=0;
while ( *str != '\0' )
hs = hs * 31 + *(str++);
return (hs & (KEY_HAS-1));
}
static KEYPTR *key_srch(char *key)
{
int hs;
KEYPTR *kp;
hs = hash_calc(key);
kp = key_hash[hs];
while ( kp != NULL ) {
if ( strcmp(key,kp->key) == 0 )
return kp;
kp = kp->next;
}
if ( (kp = (KEYPTR *)malloc(sizeof(KEYPTR))) == NULL )
return NULL;
kp->next = key_hash[hs];
key_hash[hs] = kp;
kp->key = strdup(key);
kp->flg = kp->cnt = 0;
kp->over = kp->grop = NULL;
return kp;
}
static void key_set(char *key,PRGPTR *pp)
{
int i,hs;
KEYPTR *kp;
hs = hash_calc(key);
kp = key_hash[hs];
while ( kp != NULL ) {
if ( strcmp(key,kp->key) == 0 ) {
key_now = kp;
if ( kp->grop != NULL )
kp = kp->grop;
while ( kp->cnt >= PRG_QUE ) {
for ( i = 0 ; i < kp->cnt ; i++ ) {
if ( kp->prog[i] == pp )
return;
}
if ( kp->over == NULL ) {
if ( (kp->over =
(KEYPTR *)malloc(sizeof(KEYPTR))) == NULL )
return;
kp = kp->over;
kp->cnt = 0;
kp->over = NULL;
} else
kp = kp->over;
}
goto ENDOF;
}
kp = kp->next;
}
if ( (kp = (KEYPTR *)malloc(sizeof(KEYPTR))) == NULL )
return;
kp->next = key_hash[hs];
key_hash[hs] = kp;
kp->key = strdup(key);
kp->flg = kp->cnt = 0;
kp->over = kp->grop = NULL;
key_now = kp;
if ( key_max < KEY_MAX ) {
KEY_putstr(key_max,kp->key);
key_tbl[key_max++] = kp;
}
ENDOF:
if ( pp != NULL ) {
for ( i = 0 ; i < kp->cnt ; i++ ) {
if ( kp->prog[i] == pp )
return;
}
kp->prog[kp->cnt++] = pp;
}
}
static char *chk_drv(char *dir)
{
static char tmp[BUFSIZ];
if ( dir[0] != '\0' && dir[1] == ':' )
return dir;
if ( crent_drive == NULL )
return dir;
strcpy(tmp,crent_drive);
strcat(tmp,dir);
return tmp;
}
int DB_init(char *file)
{
int i,n;
FILE *fp;
PRGPTR *pp=NULL;
KEYPTR *kp,*tp;
char *p,*s;
char tmp[BUFSIZ];
char key[BUFSIZ];
prg_max = key_max = 0;
if ( (fp = fopen(file,"r")) == NULL )
return ERR;
while ( fgets(tmp,BUFSIZ,fp) != NULL ) {
if ( (p = strchr(tmp,'\n')) != NULL )
*p = '\0';
if ( tmp[0] == '\0' || tmp[0] == '#' )
continue;
if ( strncmp(tmp,"DRIVE:",6) == 0 ) {
p = &(tmp[6]); while ( isspace(*p) ) p++;
if ( *p == '\0' )
continue;
crent_drive = strdup(p);
continue;
}
if ( strncmp(tmp,"PROGRAM:",8) == 0 ) {
p = &(tmp[8]); while ( isspace(*p) ) p++;
if ( *p == '\0' )
continue;
if ( (pp = (PRGPTR *)malloc(sizeof(PRGPTR))) == NULL )
break;
pp->next = prg_top;
prg_top = pp;
prg_max++;
pp->flg = pp->copycnt = pp->bits = 0;
pp->name = strdup(p);
pp->make = pp->readme = pp->manual = pp->dir = NULL;
continue;
}
if ( strncmp(tmp,"KEYWORD:",8) == 0 ) {
p = &(tmp[8]);
while ( *p != '\0' ) {
while ( isspace(*p) ) p++;
for ( s = key ; !isspace(*p) && *p != '\0' ; )
*(s++) = *(p++);
*s = '\0';
if ( key[0] != '\0' )
key_set(key,pp);
}
continue;
}
if ( strncmp(tmp,"GROUP:",6) == 0 ) {
tp = NULL;
p = &(tmp[6]);
while ( *p != '\0' ) {
while ( isspace(*p) ) p++;
for ( s = key ; !isspace(*p) && *p != '\0' ; )
*(s++) = *(p++);
*s = '\0';
if ( key[0] != '\0' ) {
if ( tp == NULL ) {
key_set(key,NULL);
tp = key_now;
} else {
if ( (kp = key_srch(key)) != NULL )
kp->grop = tp;
}
}
}
continue;
}
if ( pp == NULL )
continue;
if ( strncmp(tmp,"MAKE:",5) == 0 ) {
p = &(tmp[6]); while ( isspace(*p) ) p++;
if ( *p != '\0' )
pp->make = strdup(p);
} else if ( strncmp(tmp,"README:",7) == 0 ) {
p = &(tmp[7]); while ( isspace(*p) ) p++;
if ( *p != '\0' )
pp->readme = strdup(chk_drv(p));
} else if ( strncmp(tmp,"MANUAL:",7) == 0 ) {
p = &(tmp[7]); while ( isspace(*p) ) p++;
if ( *p != '\0' )
pp->manual = strdup(chk_drv(p));
} else if ( strncmp(tmp,"COPY:",5) == 0 ) {
p = &(tmp[5]);
while ( *p != '\0' ) {
while ( isspace(*p) ) p++;
for ( s = key ; !isspace(*p) && *p != '\0' ; )
*(s++) = *(p++);
*s = '\0';
if ( key[0] != '\0' && pp->copycnt < 16 )
pp->copy[pp->copycnt++] = strdup(chk_drv(key));
}
} else if ( strncmp(tmp,"DIR:",4) == 0 ) {
p = &(tmp[4]); while ( isspace(*p) ) p++;
if ( *p != '\0' )
pp->dir = strdup(chk_drv(p));
}
}
fclose(fp);
/***************************************************
for ( i = 0 ; i < 4 && i < key_max ; i++ ) {
kp = key_tbl[i];
do {
for ( n = 0 ; n < kp->cnt ; n++ )
kp->prog[n]->bits |= (1 << i);
kp = kp->over;
} while ( kp != NULL );
}
*****************************************************/
return FALSE;
}
void PRG_alldisp(int ofs)
{
int i;
PRGPTR *pp;
prg_ofs = ofs;
i = 0;
for ( pp = prg_top ; prg_cnt > 0 && pp != NULL ; pp = pp->next ) {
if ( pp->flg >= prg_cnt ) {
if ( i >= ofs && (i - ofs) < PRG_MAX ) {
PRG_disp((i-ofs),pp->name,pp->make,pp->bits);
prg_tbl[i-ofs] = pp;
}
i++;
}
}
prg_hit = i;
MENU_mask(BACK_NO,ofs > 0 ? ON:OFF);
MENU_mask(NEXT_NO,(i-ofs) > PRG_MAX ? ON:OFF);
MENU_mask(CLER_NO,prg_cnt > 0 ? ON:OFF);
while ( i >= ofs && (i - ofs) < PRG_MAX ) {
PRG_disp((i - ofs),"","",0);
prg_tbl[i-ofs] = NULL;
i++;
}
if ( prg_cnt == 0 )
MSG2_disp("%24s","");
else if ( prg_hit == 0 )
MSG2_disp("該当する作品がありません");
else
MSG2_disp("%3d個の作品があります ",prg_hit);
}
void KEY_clic(int no)
{
int i,cd;
KEYPTR *kp;
if ( no >= key_max )
return;
kp = key_tbl[no];
if ( (kp->flg = (kp->flg == 0 ? 1:0)) == 0 ) {
cd = (-1);
} else {
cd = 1;
}
KEY_disp(no);
prg_cnt += cd;
do {
for ( i = 0 ; i < kp->cnt ; i++ )
kp->prog[i]->flg += cd;
kp = kp->over;
} while ( kp != NULL );
PRG_alldisp(0);
}
void KEY_cler(void)
{
int i;
PRGPTR *pp;
for ( i = 0 ; i < key_max ; i++ ) {
if ( key_tbl[i]->flg != 0 ) {
key_tbl[i]->flg = 0;
KEY_disp(i);
}
}
for ( pp = prg_top ; pp != NULL ; pp = pp->next )
pp->flg = 0;
for ( i = 0 ; i < PRG_MAX ; i++ ) {
PRG_disp(i,"","",0);
prg_tbl[i] = NULL;
}
prg_cnt = prg_hit = 0;
MENU_mask(BACK_NO,OFF);
MENU_mask(NEXT_NO,OFF);
MENU_mask(CLER_NO,OFF);
MSG2_disp("%24s","");
}
void PRG_status(void)
{
MENU_mask(BACK_NO,prg_ofs > 0 ? ON:OFF);
MENU_mask(NEXT_NO,(prg_hit - prg_ofs) > PRG_MAX ? ON:OFF);
MENU_mask(CLER_NO,prg_cnt > 0 ? ON:OFF);
}
void PRG_back(void)
{
if ( prg_ofs <= 0 )
return;
PRG_alldisp(prg_ofs - PRG_MAX);
}
void PRG_next(void)
{
if ( (prg_ofs + PRG_MAX) >= prg_hit )
return;
PRG_alldisp(prg_ofs + PRG_MAX);
}
/*************************************************************
01234567890123456789012345678901234567890123456789012345678901234567890123456789 01234567890123456789012345678901234567890123456
+---------------------------------------------+
| PROGRAM xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| MAKE xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| KEYWORD xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| COPY xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| README xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| MANUAL xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| DIR xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx |
| | 設 定 | | 終 了 | |
+---------------------------------------------+
**************************************************************/
extern char index_file[];
extern int cut_mode;
extern char cut_buf[2][128];
#define FILE_IDX index_file
#define FSEL_X1 (5*8)
#define FSEL_Y1 (250)
#define FSEL_X2 (75*8)
#define FSEL_Y2 (FSEL_Y1+200)
#define FSEL_PROG_X (FSEL_X1+11*8)
#define FSEL_PROG_Y (FSEL_Y1+4)
#define FSEL_MAKE_X (FSEL_X1+11*8)
#define FSEL_MAKE_Y (FSEL_Y1+1*24+4)
#define FSEL_KEYW_X (FSEL_X1+11*8)
#define FSEL_KEYW_Y (FSEL_Y1+2*24+4)
#define FSEL_COPY_X (FSEL_X1+11*8)
#define FSEL_COPY_Y (FSEL_Y1+3*24+4)
#define FSEL_READ_X (FSEL_X1+11*8)
#define FSEL_READ_Y (FSEL_Y1+4*24+4)
#define FSEL_MANU_X (FSEL_X1+11*8)
#define FSEL_MANU_Y (FSEL_Y1+5*24+4)
#define FSEL_DIR_X (FSEL_X1+11*8)
#define FSEL_DIR_Y (FSEL_Y1+6*24+4)
#define FSEL_EXT_X ((FSEL_X1+FSEL_X2)/2-22*8)
#define FSEL_EXT_Y (FSEL_Y1+7*24+4)
#define FSEL_YES_X ((FSEL_X1+FSEL_X2)/2-10*8)
#define FSEL_YES_Y (FSEL_Y1+7*24+4)
#define FSEL_RET_X ((FSEL_X1+FSEL_X2)/2+2*8)
#define FSEL_RET_Y (FSEL_Y1+7*24+4)
#define LIST_X (17*8)
#define LIST_Y 26
#define LIST_M "マニュアル表示"
#define LIST_X1 (LIST_X-4)
#define LIST_Y1 (LIST_Y-2)
#define LIST_X2 (LIST_X+14*8+3)
#define LIST_Y2 (LIST_Y+17)
#define KEY_X 8
#define KEY_Y 69
#define KEY_L (18*8)
#define KEY_S (20*8)
#define KEY_POS_X(n) ((n%4)*KEY_S+KEY_X)
#define KEY_POS_Y(n) ((n/4)*24+KEY_Y)
void eof_chk(FILE *fp)
{
int ch;
_setmode(fp,_BINARY);
fseek(fp,(-50L),SEEK_END);
while ( (ch = getc(fp)) != EOF && ch != 0x1A );
if ( ch == 0x1A ) {
fseek(fp,(-1L),SEEK_CUR);
} else {
clearerr(fp);
fseek(fp,0L,SEEK_END);
}
_setmode(fp,_TEXT);
}
void KEY_input(void)
{
int i,n,j;
int sw,bx,by;
FILE *fp;
BLOCK *sp;
EVENT *ep=NULL;
PRGPTR *pp;
char *p,*s;
char tmp[256];
char key[BUFSIZ];
static char dmy[7][BUFSIZ];
if ( (fp = fopen(FILE_IDX,"r+")) == NULL ) {
if ( (fp = fopen(FILE_IDX,"w")) == NULL )
return;
} else
eof_chk(fp);
dmy[0][0] = dmy[1][0] = dmy[2][0] = dmy[3][0] =
dmy[4][0] = dmy[5][0] = dmy[6][0] = '\0';
MOS_disp(OFF);
sp = DSP_push_vram(FSEL_X1,FSEL_Y1,FSEL_X2,FSEL_Y2);
DSP_opbox(FSEL_X1,FSEL_Y1,FSEL_X2,FSEL_Y2);
DSP_wbox(FSEL_X1,FSEL_Y1,FSEL_X2,FSEL_Y2,LINE_COL,MENU_COL,M_PSET);
ep = EVT_set(ep,500,LIST_X1,LIST_Y1,LIST_X2,LIST_Y2,EVT_proc);
for ( i = 0 ; i < 28 ; i++ ) {
ep = EVT_set(ep,i+300,
KEY_POS_X(i)-4,KEY_POS_Y(i)-2,
KEY_POS_X(i)+KEY_L+3,KEY_POS_Y(i)+17,EVT_proc);
}
sprintf(tmp,"%-44.44s",dmy[0]);
ep = EVT_sw(ep,0,FSEL_PROG_X,FSEL_PROG_Y,CHR_COL,WIND_COL,tmp);
sprintf(tmp,"%-31.31s",dmy[1]);
ep = EVT_sw(ep,1,FSEL_MAKE_X,FSEL_MAKE_Y,CHR_COL,WIND_COL,tmp);
sprintf(tmp,"%-58.58s",dmy[2]);
ep = EVT_sw(ep,2,FSEL_KEYW_X,FSEL_KEYW_Y,CHR_COL,WIND_COL,tmp);
sprintf(tmp,"%-58.58s",dmy[3]);
ep = EVT_sw(ep,3,FSEL_COPY_X,FSEL_COPY_Y,CHR_COL,WIND_COL,tmp);
sprintf(tmp,"%-58.58s",dmy[4]);
ep = EVT_sw(ep,4,FSEL_READ_X,FSEL_READ_Y,CHR_COL,WIND_COL,tmp);
sprintf(tmp,"%-58.58s",dmy[5]);
ep = EVT_sw(ep,5,FSEL_MANU_X,FSEL_MANU_Y,CHR_COL,WIND_COL,tmp);
sprintf(tmp,"%-58.58s",dmy[6]);
ep = EVT_sw(ep,6,FSEL_DIR_X,FSEL_DIR_Y,CHR_COL,WIND_COL,tmp);
ep = EVT_sw(ep,10,FSEL_X1+8,FSEL_PROG_Y,CHR_COL,KEY_COL,"PROGRAM");
ep = EVT_sw(ep,11,FSEL_X1+8,FSEL_MAKE_Y,CHR_COL,KEY_COL,"MAKE ");
ep = EVT_sw(ep,12,FSEL_X1+8,FSEL_KEYW_Y,CHR_COL,KEY_COL,"KEYWORD");
ep = EVT_sw(ep,13,FSEL_X1+8,FSEL_COPY_Y,CHR_COL,KEY_COL,"COPY ");
ep = EVT_sw(ep,14,FSEL_X1+8,FSEL_READ_Y,CHR_COL,KEY_COL,"README ");
ep = EVT_sw(ep,15,FSEL_X1+8,FSEL_MANU_Y,CHR_COL,KEY_COL,"MANUAL ");
ep = EVT_sw(ep,16,FSEL_X1+8,FSEL_DIR_Y, CHR_COL,KEY_COL,"DIR ");
ep = EVT_sw(ep,110,FSEL_EXT_X,FSEL_EXT_Y,CHR_COL,WIND_COL," 簡 単 ");
ep = EVT_sw(ep,100,FSEL_YES_X,FSEL_YES_Y,CHR_COL,WIND_COL," 設 定 ");
ep = EVT_sw(ep,200,FSEL_RET_X,FSEL_RET_Y,CHR_COL,WIND_COL," もどる ");
MOS_rdpos(&sw,&bx,&by);
MOS_setpos((FSEL_X1+FSEL_X2)/2,(FSEL_Y1+FSEL_Y2)/2);
MOS_disp(ON);
for ( ; ; ) {
i = EVT_wait(ep);
if ( i == 0 ) {
MOS_disp(OFF);
input(FSEL_PROG_X,FSEL_PROG_Y+i*24,44,dmy[i]);
MOS_disp(ON);
} else if ( i == 1 ) {
MOS_disp(OFF);
input(FSEL_PROG_X,FSEL_PROG_Y+i*24,31,dmy[i]);
MOS_disp(ON);
} else if ( i >= 2 && i <= 6 ) {
MOS_disp(OFF);
input(FSEL_PROG_X,FSEL_PROG_Y+i*24,58,dmy[i]);
MOS_disp(ON);
} else if ( i >= 10 && i <= 11 ) {
if ( (p = FILE_select()) != NULL ) {
MENU_mask(RETN_NO,ON);
cut_mode = TRUE;
FILE_open(p);
while ( MENU_no(0) != CLER_NO )
FILE_irq();
MENU_mask(CLER_NO,OFF);
FILE_close();
cut_mode = FALSE;
n = i - 10;
strcat(dmy[n],cut_buf[0]);
MOS_disp(OFF);
gprintf(FSEL_PROG_X,FSEL_PROG_Y+n*24,
CHR_COL,WIND_COL,
n == 0 ? "%-44.44s":
(n == 1 ? "%-31.31s":
"%-58.58s"),dmy[n]);
MOS_disp(ON);
}
} else if ( i == 110 ) {
if ( (p = FILE_select()) != NULL ) {
MENU_mask(RETN_NO,ON);
cut_mode = TRUE;
FILE_open(p);
while ( MENU_no(0) != CLER_NO )
FILE_irq();
MENU_mask(CLER_NO,OFF);
FILE_close();
cut_mode = FALSE;
strcpy(dmy[0],cut_buf[0]);
strcpy(dmy[1],cut_buf[1]);
getdir(dmy[6]);
MOS_disp(OFF);
gprintf(FSEL_PROG_X,FSEL_PROG_Y,
CHR_COL,WIND_COL,"%-44.44s",dmy[0]);
gprintf(FSEL_MAKE_X,FSEL_MAKE_Y,
CHR_COL,WIND_COL,"%-31.31s",dmy[1]);
CHR_COL,WIND_COL,
gprintf(FSEL_DIR_X,FSEL_DIR_Y,
CHR_COL,WIND_COL,"%-58.58s",dmy[6]);
MOS_disp(ON);
}
} else if ( i >= 13 && i <= 15 ) {
if ( (p = FILE_select()) != NULL ) {
/********************************************
tmp[0] = 'A' + getdrv();
tmp[1] = ':';
getdir(tmp+2);
if ( tmp[3] != '\0' )
strcat(tmp,"\\");
strcat(tmp,p);
*********************************************/
getdir(tmp);
if ( tmp[1] != '\0' )
strcat(tmp,"\\");
strcat(tmp,p);
n = i - 10;
if ( dmy[n][0] != '\0' )
strcat(dmy[n]," ");
strcat(dmy[n],tmp);
MOS_disp(OFF);
gprintf(FSEL_PROG_X,FSEL_PROG_Y+n*24,
CHR_COL,WIND_COL,"%-58.58s",dmy[n]);
MOS_disp(ON);
}
} else if ( i == 16 ) {
FILE_select();
/*******************************************
tmp[0] = 'A' + getdrv();
tmp[1] = ':';
getdir(tmp+2);
*******************************************/
getdir(tmp);
n = i - 10;
strcpy(dmy[n],tmp);
MOS_disp(OFF);
gprintf(FSEL_PROG_X,FSEL_PROG_Y+n*24,
CHR_COL,WIND_COL,"%-58.58s",dmy[n]);
MOS_disp(ON);
} else if ( i == 500 ) {
LIST_proc();
} else if ( i >= 300 ) {
if ( key_tbl[i-300] != NULL ) {
if ( dmy[2][0] != '\0' )
strcat(dmy[2]," ");
strcat(dmy[2],key_tbl[i-300]->key);
MOS_disp(OFF);
gprintf(FSEL_KEYW_X,FSEL_KEYW_Y,
CHR_COL,WIND_COL,"%-58.58s",dmy[2]);
MOS_disp(ON);
}
} else if ( i == 100 ) {
if ( dmy[0][0] == '\0' &&
yesno("作品名が無いけど?") == ERR )
continue;
if ( dmy[1][0] == '\0' &&
yesno("作者名が無いけど?") == ERR )
continue;
if ( dmy[2][0] == '\0' &&
yesno("キ-ワ-ドが無いけど?") == ERR )
continue;
if ( dmy[3][0] == '\0' && dmy[4][0] == '\0' &&
dmy[5][0] == '\0' && dmy[6][0] == '\0' &&
yesno("ファイル指定が無いけど?") == ERR )
continue;
fprintf(fp,"\n");
fprintf(fp,"PROGRAM: %s\n",dmy[0]);
fprintf(fp,"MAKE: %s\n",dmy[1]);
fprintf(fp,"KEYWORD: %s\n",dmy[2]);
if ( dmy[3][0] != '\0' )
fprintf(fp,"COPY: %s\n",dmy[3]);
if ( dmy[4][0] != '\0' )
fprintf(fp,"README: %s\n",dmy[4]);
if ( dmy[5][0] != '\0' )
fprintf(fp,"MANUAL: %s\n",dmy[5]);
if ( dmy[6][0] != '\0' )
fprintf(fp,"DIR: %s\n",dmy[6]);
if ( (pp = (PRGPTR *)malloc(sizeof(PRGPTR))) == NULL )
break;
pp->next = prg_top;
prg_top = pp;
prg_max++;
pp->flg = pp->copycnt = pp->bits = 0;
pp->name = strdup(dmy[0]);
pp->make = pp->readme = pp->manual = pp->dir = NULL;
if ( dmy[1][0] != '\0' )
pp->make = strdup(dmy[1]);
if ( dmy[4][0] != '\0' )
pp->readme = strdup(chk_drv(dmy[4]));
if ( dmy[5][0] != '\0' )
pp->manual = strdup(chk_drv(dmy[5]));
if ( dmy[6][0] != '\0' )
pp->dir = strdup(chk_drv(dmy[6]));
p = dmy[3];
while ( *p != '\0' ) {
while ( isspace(*p) ) p++;
for ( s = key ; !isspace(*p) && *p != '\0' ; )
*(s++) = *(p++);
*s = '\0';
if ( key[0] != '\0' && pp->copycnt < 16 )
pp->copy[pp->copycnt++] = strdup(chk_drv(key));
}
p = dmy[2];
while ( *p != '\0' ) {
while ( isspace(*p) ) p++;
for ( s = key ; !isspace(*p) && *p != '\0' ; )
*(s++) = *(p++);
*s = '\0';
if ( key[0] != '\0' )
key_set(key,pp);
}
dmy[0][0] = dmy[1][0] = dmy[2][0] = dmy[3][0] =
dmy[4][0] = dmy[5][0] = dmy[6][0] = '\0';
MOS_disp(OFF);
gprintf(FSEL_PROG_X,FSEL_PROG_Y,
CHR_COL,WIND_COL,"%-44.44s",dmy[0]);
gprintf(FSEL_MAKE_X,FSEL_MAKE_Y,
CHR_COL,WIND_COL,"%-31.31s",dmy[1]);
gprintf(FSEL_KEYW_X,FSEL_KEYW_Y,
CHR_COL,WIND_COL,"%-58.58s",dmy[2]);
gprintf(FSEL_COPY_X,FSEL_COPY_Y,
CHR_COL,WIND_COL,"%-58.58s",dmy[3]);
gprintf(FSEL_READ_X,FSEL_READ_Y,
CHR_COL,WIND_COL,"%-58.58s",dmy[4]);
gprintf(FSEL_MANU_X,FSEL_MANU_Y,
CHR_COL,WIND_COL,"%-58.58s",dmy[5]);
gprintf(FSEL_DIR_X,FSEL_DIR_Y,
CHR_COL,WIND_COL,"%-58.58s",dmy[6]);
MOS_disp(ON);
} else if ( i == 200 ) {
break;
}
}
EVT_free(ep);
MOS_disp(OFF);
DSP_pop_vram(sp);
MOS_setpos(bx,by);
MOS_disp(ON);
fclose(fp);
}